//
// Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
//
// GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
//  Author: Shawn.Tan
//  Date : 2025.10.28
//
//  History : Initial Version 2025.10.28
//
//
#ifndef Green_OperandSolutionMap_H
#define Green_OperandSolutionMap_H

#include <algorithm>
#include <utility>
#include <vector>

#include "Defines.h"
#include "Log.h"

using namespace std;

namespace Green {

  class OperandSolution;

  /*!
   *\class OperandSolutionMap
   *\brief Wrapper around an stl vector to (string, OperandSolution) pairs that preserves insertion order and emulates two functions from std::map.
   *
   */
  class OperandSolutionMap {
  public:
    OperandSolutionMap();
    COPY_CONSTRUCTOR_DEFAULT(OperandSolutionMap);
    DESTRUCTOR_DEFAULT(OperandSolutionMap);
    ASSIGNMENT_OPERATOR_DEFAULT(OperandSolutionMap);

    vector<std::pair<std::string, OperandSolution> >::iterator find(const std::string& k);

    vector<std::pair<std::string, OperandSolution> >::iterator end();

    vector<pair<std::string, OperandSolution> >::const_iterator end() const;

    vector<pair<std::string, OperandSolution> >::iterator begin();

    vector<pair<std::string, OperandSolution> >::const_iterator begin() const;

    size_t size() const;

    void emplace(const std::string& k, OperandSolution&& ropr_sol);

  private:
    std::vector<std::pair<std::string, OperandSolution> > mStorage;
  };
}

#endif
